package com.luluteam.pushlib.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;

/**
 * 用于标记这个Activity是否是阅读消息的Activity
 * 凡是Intent中带有TagParams的Activity，该SDK均会记录Activity的生命周期，用于标记阅读时间等
 *
 * @author Guan
 * @date Created on 2018/12/11
 */
public class TagParams implements Parcelable {

    public static final String INTENT_TAG_PARAMS = "IntentTagParams";

    private String messageId;

    private ArrayList<TargetParams> targetParams;

    public TagParams() {

    }

    protected TagParams(Parcel in) {
        messageId = in.readString();
        targetParams = in.createTypedArrayList(TargetParams.CREATOR);
    }

    public static final Creator<TagParams> CREATOR = new Creator<TagParams>() {
        @Override
        public TagParams createFromParcel(Parcel in) {
            return new TagParams(in);
        }

        @Override
        public TagParams[] newArray(int size) {
            return new TagParams[size];
        }
    };

    public String getMessageId() {
        return messageId;
    }

    public void setMessageId(String messageId) {
        this.messageId = messageId;
    }

    public ArrayList<TargetParams> getTargetParams() {
        return targetParams;
    }

    public void setTargetParams(ArrayList<TargetParams> targetParams) {
        this.targetParams = targetParams;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(messageId);
        dest.writeTypedList(targetParams);
    }
}
